home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb.new / gdb-3.98 / include / intel-coff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-01  |  6.4 KB  |  249 lines

  1. /*** coff information for 80960.  Origins: Intel corp, natch. */
  2.  
  3. /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */
  4.  
  5. /********************** FILE HEADER **********************/
  6.  
  7. struct external_filehdr {
  8.     char f_magic[2];    /* magic number            */
  9.     char f_nscns[2];    /* number of sections        */
  10.     char f_timdat[4];    /* time & date stamp        */
  11.     char f_symptr[4];    /* file pointer to symtab    */
  12.     char f_nsyms[4];    /* number of symtab entries    */
  13.     char f_opthdr[2];    /* sizeof(optional hdr)        */
  14.     char f_flags[2];    /* flags            */
  15. };
  16.  
  17. #define OMAGIC      (0407)    /* old impure format. data immediately
  18.                                    follows text. both sections are rw. */
  19. #define NMAGIC      (0410)    /* split i&d, read-only text */
  20.  
  21. /*
  22. *    Intel 80960 (I960) processor flags.
  23. *    F_I960TYPE == mask for processor type field. 
  24. */
  25.  
  26. #define    F_I960TYPE    (0xf000)
  27. #define    F_I960CORE    (0x1000)
  28. #define    F_I960KB    (0x2000)
  29. #define    F_I960SB    (0x2000)
  30. #define    F_I960MC    (0x3000)
  31. #define    F_I960XA    (0x4000)
  32. #define    F_I960CA    (0x5000)
  33. #define    F_I960KA    (0x6000)
  34. #define    F_I960SA    (0x6000)
  35.  
  36.  
  37. /** i80960 Magic Numbers
  38. */
  39.  
  40. #define I960ROMAGIC    (0x160)    /* read-only text segments */
  41. #define I960RWMAGIC    (0x161)    /* read-write text segments */
  42.  
  43. #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC))
  44.  
  45. #define    FILHDR    struct external_filehdr
  46. #define    FILHSZ    20
  47.  
  48. /********************** AOUT "OPTIONAL HEADER" **********************/
  49.  
  50. typedef struct {
  51.     unsigned long    phys_addr;
  52.     unsigned long    bitarray;
  53. } TAGBITS;
  54.  
  55.  
  56.  
  57. typedef struct 
  58. {
  59.   char     magic[2];        /* type of file                */
  60.   char    vstamp[2];        /* version stamp            */
  61.   char    tsize[4];        /* text size in bytes, padded to FW bdry*/
  62.   char    dsize[4];        /* initialized data "  "        */
  63.   char    bsize[4];        /* uninitialized data "   "        */
  64.   char    entry[4];        /* entry pt.                */
  65.   char     text_start[4];        /* base of text used for this file */
  66.   char     data_start[4];        /* base of data used for this file */
  67.   char    tagentries[4];        /* number of tag entries to follow */
  68. }
  69. AOUTHDR;
  70.  
  71. /* return a pointer to the tag bits array */
  72.  
  73. #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
  74.  
  75. /* compute size of a header */
  76.  
  77. /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
  78. #define AOUTSZ (sizeof(AOUTHDR))
  79.  
  80.  
  81.  
  82. /********************** SECTION HEADER **********************/
  83.  
  84.  
  85. struct external_scnhdr {
  86.     char        s_name[8];    /* section name            */
  87.     char        s_paddr[4];    /* physical address, aliased s_nlib */
  88.     char        s_vaddr[4];    /* virtual address        */
  89.     char        s_size[4];    /* section size            */
  90.     char        s_scnptr[4];    /* file ptr to raw data for section */
  91.     char        s_relptr[4];    /* file ptr to relocation    */
  92.     char        s_lnnoptr[4];    /* file ptr to line numbers    */
  93.     char        s_nreloc[2];    /* number of relocation entries    */
  94.     char        s_nlnno[2];    /* number of line number entries*/
  95.     char        s_flags[4];    /* flags            */
  96.     char         s_align[4];    /* section alignment        */
  97. };
  98.  
  99.  
  100. #define    SCNHDR    struct external_scnhdr
  101. #define    SCNHSZ    sizeof(SCNHDR)
  102.  
  103.  
  104. /********************** LINE NUMBERS **********************/
  105.  
  106. /* 1 line number entry for every "breakpointable" source line in a section.
  107.  * Line numbers are grouped on a per function basis; first entry in a function
  108.  * grouping will have l_lnno = 0 and in place of physical address will be the
  109.  * symbol table index of the function name.
  110.  */
  111. struct external_lineno {
  112.     union {
  113.         char l_symndx[4];    /* function name symbol index, iff l_lnno == 0*/
  114.         char l_paddr[4];    /* (physical) address of line number    */
  115.     } l_addr;
  116.     char l_lnno[2];        /* line number        */
  117.     char padding[2];    /* force alignment    */
  118. };
  119.  
  120.  
  121. #define    LINENO    struct external_lineno
  122. #define    LINESZ    8
  123.  
  124.  
  125. /********************** SYMBOLS **********************/
  126.  
  127. #define SYMNMLEN    8    /* # characters in a symbol name    */
  128. #define FILNMLEN    14    /* # characters in a file name        */
  129. #define DIMNUM        4    /* # array dimensions in auxiliary entry */
  130.  
  131. struct external_syment 
  132. {
  133.   union {
  134.     char e_name[SYMNMLEN];
  135.     struct {
  136.       char e_zeroes[4];
  137.       char e_offset[4];
  138.     } e;
  139.   } e;
  140.   char e_value[4];
  141.   char e_scnum[2];
  142.   char e_flags[2];
  143.   char e_type[4];
  144.   char e_sclass[1];
  145.   char e_numaux[1];
  146.   char pad2[2];
  147. };
  148.  
  149.  
  150.  
  151.  
  152. #define N_BTMASK    (0x1f)
  153. #define N_TMASK        (0x60)
  154. #define N_BTSHFT    (5)
  155. #define N_TSHIFT    (2)
  156.   
  157. union external_auxent {
  158.     struct {
  159.         char x_tagndx[4];    /* str, un, or enum tag indx */
  160.         union {
  161.             struct {
  162.                 char  x_lnno[2]; /* declaration line number */
  163.                 char  x_size[2]; /* str/union/array size */
  164.             } x_lnsz;
  165.             char x_fsize[4];    /* size of function */
  166.         } x_misc;
  167.         union {
  168.             struct {        /* if ISFCN, tag, or .bb */
  169.                 char x_lnnoptr[4];    /* ptr to fcn line # */
  170.                 char x_endndx[4];    /* entry ndx past block end */
  171.             } x_fcn;
  172.             struct {        /* if ISARY, up to 4 dimen. */
  173.                 char x_dimen[DIMNUM][2];
  174.             } x_ary;
  175.         } x_fcnary;
  176.         char x_tvndx[2];        /* tv index */
  177.     } x_sym;
  178.  
  179.     union {
  180.         char x_fname[FILNMLEN];
  181.         struct {
  182.             char x_zeroes[4];
  183.             char x_offset[4];
  184.         } x_n;
  185.     } x_file;
  186.  
  187.     struct {
  188.         char x_scnlen[4];            /* section length */
  189.         char x_nreloc[2];    /* # relocation entries */
  190.         char x_nlinno[2];    /* # line numbers */
  191.     } x_scn;
  192.  
  193.         struct {
  194.         char x_tvfill[4];    /* tv fill value */
  195.         char x_tvlen[2];    /* length of .tv */
  196.         char x_tvran[2][2];    /* tv range */
  197.     } x_tv;        /* info about .tv section (in auxent of symbol .tv)) */
  198.  
  199.     /******************************************
  200.      *  I960-specific *2nd* aux. entry formats
  201.      ******************************************/
  202.     struct {
  203.       /* This is a very old typo that keeps getting propagated. */
  204. #define x_stdindx x_stindx
  205.         char x_stindx[4];    /* sys. table entry */
  206.     } x_sc;    /* system call entry */
  207.  
  208.     struct {
  209.         char x_balntry[4]; /* BAL entry point */
  210.     } x_bal; /* BAL-callable function */
  211.  
  212.         struct {
  213.         char x_timestamp[4];            /* time stamp */
  214.         char     x_idstring[20];            /* producer identity string */
  215.     } x_ident;                            /* Producer ident info */
  216.  
  217. };
  218.  
  219.  
  220.  
  221. #define    SYMENT    struct external_syment
  222. #define    SYMESZ    sizeof(SYMENT)            /* FIXME - calc by hand */
  223. #define    AUXENT    union external_auxent
  224. #define    AUXESZ    sizeof(AUXENT)            /* FIXME - calc by hand */
  225.  
  226. #    define _ETEXT    "_etext"
  227.  
  228. /********************** RELOCATION DIRECTIVES **********************/
  229.  
  230. struct external_reloc {
  231.   char r_vaddr[4];
  232.   char r_symndx[4];
  233.   char r_type[2];
  234.   char pad[2];
  235. };
  236.  
  237.  
  238. /* Relevent values for r_type and i960.  Would someone please document them */
  239.  
  240.  
  241. #define RELOC struct external_reloc
  242. #define RELSZ 12
  243.  
  244. #define DEFAULT_DATA_SECTION_ALIGNMENT 4
  245. #define DEFAULT_BSS_SECTION_ALIGNMENT 4
  246. #define DEFAULT_TEXT_SECTION_ALIGNMENT 16
  247. /* For new sections we havn't heard of before */
  248. #define DEFAULT_SECTION_ALIGNMENT 4
  249.